var status = 0;

function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == -1) {
        cm.dispose();
    } else {
        if (mode == 0) {
            cm.dispose();
            return;
        }
        if (mode == 1)
            status++;
        else
            status--;
        if (status == 0) {
            cm.sendSimple ("                您好，尊敬的#b#h # #k\r\n               欢迎来到#rCongMS#k养老中心#k\r\n [每日可领取5000抵用，50时装币，10个毕业防具碎片，10块金钱道具以及50强化石 ]\r\n#L0# 礼包虽小请勿嫌弃#r礼轻情义重！！！！#n#k#l");
        } else if (status == 1) {
            switch(selection) {
        case 0:
           if (cm.getBossLog("每日养老奖励1") < 1) {
               	cm.gainDY(5000);//1
                cm.gainMeso(100000);//给金币
                cm.gainItem(4031040, 10);
                cm.gainItem(4310154, 50);
				cm.gainItem(4033732, 10);
				cm.gainItem(4033751, 50);
				cm.gainItem(4001760, 3);				
				cm.setBossLog("每日养老奖励1");			
			   // cm.gainMeso(3000000);   //金币
			   // cm.gainNX(8000);//1
                //cm.gainDY(+30000);
                cm.sendOk("恭喜你，你获得了养老礼包! .");   			
				//Packages.handling.world.World.Broadcast.broadcastMessage(Packages.tools.MaplePacketCreator.serverNotice(12, cm.getClient().getChannel(), "『萌新福利』" + " : " + "[" + cm.getChar().getName() + "]成功领取了新手礼包,祝所有玩家游戏愉快！"));
                cm.dispose();
            }else{
                cm.sendOk("每天只能领取一次~");
                cm.dispose();
            }
            break;
        case 1: 
			if(cm.getLevel()>= 100 && cm.getBossLog('PlayQuest1') < 1){
  		cm.gainItem(1113091,6,6,6,6,200,200,6,6,0,0,0,0,0,0);
		cm.setBossLog('PlayQuest1');
                cm.sendOk("恭喜你，你获得了一个很牛逼的飞奔戒指! .");
Packages.handling.world.World.Broadcast.broadcastMessage(Packages.tools.MaplePacketCreator.serverNotice(12, cm.getClient().getChannel(), "『萌新福利』" + " : " + "[" + cm.getChar().getName() + "]成功领取了100级萌新奖励,祝所有玩家游戏愉快！"));
                cm.dispose();
            }else{
                cm.sendOk("你没有达到等级要求，或者已经兑换过~.");
                cm.dispose();
            }
            break;
         case 2: 
			if(cm.getLevel()>= 150 && cm.getBossLog('PlayQuest2') < 1){
  		cm.gainItem(1142650,20,20,20,20,400,400,10,10,40,40,40,40,40,40);
		cm.setBossLog('PlayQuest2');
                cm.sendOk("恭喜你，你获得了一个很牛逼很炫酷的称号! .");
Packages.handling.world.World.Broadcast.broadcastMessage(Packages.tools.MaplePacketCreator.serverNotice(12, cm.getClient().getChannel(), "『萌新福利』" + " : " + "[" + cm.getChar().getName() + "]成功领取了150级萌新奖励,祝所有玩家游戏愉快！"));
                cm.dispose();
            }else{
                cm.sendOk("你没有达到等级要求，或者已经兑换过~.");
                cm.dispose();
            }
            break;
            case 3: 
 if(cm.getLevel()>= 200 && cm.getBossLog('PlayQuest3') < 1){
  		cm.gainItem(1142472,25,25,25,25,600,600,15,15,40,40,40,40,40,40);
		cm.setBossLog('PlayQuest3');
                cm.sendOk("恭喜你，你获得了一个超级牛逼超级炫酷的称号! .");
Packages.handling.world.World.Broadcast.broadcastMessage(Packages.tools.MaplePacketCreator.serverNotice(12, cm.getClient().getChannel(), "『萌新福利』" + " : " + "[" + cm.getChar().getName() + "]成功领取了200级萌新奖励,祝所有玩家游戏愉快！"));
                cm.dispose();
            }else{
                cm.sendOk("你没有达到等级要求，或者已经兑换过~.");
                cm.dispose();
            }
            break;
            case 4: 
			if(cm.getLevel()>= 1 && cm.getBossLog('PlayQuest4') < 1){
  		cm.gainItem(4001126,6666);
		cm.setBossLog('PlayQuest4');
                cm.gainDY(1000000);
                cm.gainNX(1000000);
                cm.gainMeso(2000000000);
			        cm.worldMessage(6,"【兑换系统】["+cm.getName()+"]点券金币 请点拍卖新人礼包领取！");
				cm.dispose();
            }else{
                cm.sendOk("每天只能领取一次~.");
                cm.dispose();
            }
            break;
            case 5: 
		cm.openNpc(9900004, 10000);
            break;
           case 6: 
            if(cm.haveItem(4001126,100)){
                cm.gainItem(4000313,10);
				cm.gainItem(4001126,-100);
				cm.sendOk("恭喜你，你获得了 10张黄金枫叶! .");
			        cm.worldMessage(6,"【兑换系统】["+cm.getName()+"]100张枫叶兑换10张黄金枫叶成功！");
				cm.dispose();
            }else{
                cm.sendOk("你没有 足够的 枫叶，我不能给你换购~.");
                cm.dispose();
            }
            break;
            case 7: 
            if(cm.getMeso() >= 10000000){
                cm.sendOk("恭喜你，你获得了 2000000 经验值! .");
                cm.gainMeso(-10000000);
                cm.gainExp(2000000);
                cm.dispose();
            }else{
                cm.sendOk("你没有 10000000 金币，我不能给你换购~.");
                cm.dispose();
            }
            break;
            case 8: 
            if(cm.getMeso() >= 100000000){
                cm.sendOk("恭喜你，你获得了 50000000 经验值! .");
                cm.gainMeso(-100000000);
                cm.gainExp(50000000);
                cm.dispose();
            }else{
                cm.sendOk("你没有 1亿 金币，我不能给你换购~.");
                cm.dispose();
            }
            break;
            case 9: 
                cm.openNpc(9270052, 0);
            break;
            case 10: 
            if(cm.haveItem(4031250,100)){
                cm.gainNX(2000);
				cm.gainItem(4031250,-100);
				cm.sendOk("恭喜你，你获得了 2000点券! .");
			        cm.worldMessage(6,"【兑换系统】["+cm.getName()+"]100个盛大易宝兑换2000点券成功！");
				cm.dispose();
            }else{
                cm.sendOk("你没有 足够的 盛大易宝，我不能给你换购~.");
                cm.dispose();
            }
            break;
            case 11: 
            if(cm.haveItem(4031250,100)){
                cm.gainItem(4000313,10);
				cm.gainItem(4031250,-100);
				cm.sendOk("恭喜你，你获得了 10张黄金枫叶! .");
			        cm.worldMessage(6,"【兑换系统】["+cm.getName()+"]100个盛大易宝兑换10张黄金枫叶成功！");
				cm.dispose();
            }else{
                cm.sendOk("你没有 足够的 盛大易宝，我不能给你换购~.");
                cm.dispose();
            }
            break;
            case 12: 
            if(cm.haveItem(4031250,100)){
                cm.gainItem(4032226,10);
				cm.gainItem(4031250,-100);
				cm.sendOk("恭喜你，你获得了 10只黄金猪猪! .");
			        cm.worldMessage(6,"【兑换系统】["+cm.getName()+"]100个盛大易宝兑换10只黄金猪猪成功！");
				cm.dispose();
            }else{
                cm.sendOk("你没有 足够的 盛大易宝，我不能给你换购~.");
                cm.dispose();
            }
            break;
            }
        }
    }
}